package com.psj.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Date;

@Aspect
@Component
public class MyAspect {

    /*@Pointcut(value = "execution( * com.psj.controller.list*.*(..) ) ")
    public void poin(){

    }*/
    @Pointcut(value = "@annotation(com.psj.aspect.MyLog)")
    public void poin(){

    }

    @Around(value = "poin()")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {

        long begin1 = System.currentTimeMillis();
        Object proceed = joinPoint.proceed();
        long end1 = System.currentTimeMillis();
        System.out.println("##############添加方法执行时间为："+(end1-begin1)+"毫秒");
        System.out.println("##############添加方法执行时间为："+(end1-begin1)+"毫秒");
        System.out.println("##############添加方法执行时间为："+(end1-begin1)+"毫秒");

        return proceed;
    }



}
